﻿using SqlSugar;
using SqlSugar_Geometry_Model.Entity;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace SqlSugar_Geometry_Model.Service
{
    public class DbService
    {
        /// <summary>
        /// 保存Test对象
        /// </summary>
        /// <param name="test">test对象</param>
        /// <returns></returns>
        public int saveTest(Test test)
        {
            using (SqlSugarClient db = new DbHelper().GetDb())
            {
                return db.Insertable(test).ExecuteReturnIdentity();
            }
        }

        /// <summary>
        /// 查询所有Test信息
        /// </summary>
        /// <returns></returns>
        public List<Test> getTests()
        {
            using (SqlSugarClient db = new DbHelper().GetDb())
            {
                var tests = db.Queryable<Test>()
                    .ToList();
                return tests;
            }
        }
    }
}